home *** CD-ROM | disk | FTP | other *** search
/ Champak 146 / (Vol 146) Jan 07 2012.iso / Games / super_fly.swf / scripts / DefineButton2_91 / BUTTONCONDACTION on(press).as
Text File  |  2012-01-07  |  3KB  |  98 lines

  1. on(press){
  2.    if(getProperty("/frog/fline", _currentframe) < "2")
  3.    {
  4.       if(getProperty("/head", _currentframe) == "1")
  5.       {
  6.          mouse_x = getProperty("/pos", _X);
  7.          mouse_y = getProperty("/pos", _Y);
  8.          s_x = "67.3";
  9.          s_y = "156.8";
  10.          call("catch");
  11.          x_dist = mouse_x - s_x;
  12.          y_dist = mouse_y - s_y;
  13.          input = y_dist * y_dist + x_dist * x_dist;
  14.          call("sqroot");
  15.          tongLength = tongLength;
  16.          pi = "3.1416";
  17.          deltax = getProperty("/pos", _X) - getProperty("/start", _X);
  18.          deltay = getProperty("/pos", _Y) - getProperty("/start", _Y);
  19.          ratio = deltay / deltax;
  20.          if("0" < deltax)
  21.          {
  22.             if("1" < ratio)
  23.             {
  24.                input = "1" / ratio;
  25.                call("arctan");
  26.                angle = "90" - output * "180" / pi;
  27.             }
  28.             else if("0" < ratio and ratio < "1")
  29.             {
  30.                input = ratio;
  31.                call("arctan");
  32.                angle = output * "180" / "3.14";
  33.             }
  34.             else if(ratio < "0" and - "1" < ratio)
  35.             {
  36.                input = ratio;
  37.                call("arctan");
  38.                angle = "360" + output * "180" / "3.14";
  39.             }
  40.             else if(ratio < - "1")
  41.             {
  42.                input = "1" / ratio;
  43.                call("arctan");
  44.                angle = "270" - output * "180" / pi;
  45.             }
  46.          }
  47.          else if(deltax < "0")
  48.          {
  49.             if("1" < ratio)
  50.             {
  51.                input = "1" / ratio;
  52.                call("arctan");
  53.                angle = "270" - output * "180" / pi;
  54.             }
  55.             else if("0" < ratio and ratio < "1")
  56.             {
  57.                input = ratio;
  58.                call("arctan");
  59.                angle = "180" + output * "180" / "3.14";
  60.             }
  61.             else if(ratio < "0" and - "1" < ratio)
  62.             {
  63.                input = ratio;
  64.                call("arctan");
  65.                angle = "180" + output * "180" / "3.14";
  66.             }
  67.             else if(ratio < - "1")
  68.             {
  69.                input = "1" / ratio;
  70.                call("arctan");
  71.                angle = "90" - output * "180" / pi;
  72.             }
  73.          }
  74.          else if(deltax == "0")
  75.          {
  76.             if("0" < deltay)
  77.             {
  78.                angle = "90";
  79.             }
  80.             else if(deltay < "0")
  81.             {
  82.                angle = - "90";
  83.             }
  84.             else if(deltay == "0")
  85.             {
  86.                angle = "null";
  87.             }
  88.          }
  89.          setProperty("/dline", _rotation, angle);
  90.          set("/dline:tongLength",tongLength);
  91.          tellTarget("/dline")
  92.          {
  93.             gotoAndPlay(1);
  94.          }
  95.       }
  96.    }
  97. }
  98.